Previous Next

Sending 802.1Q-Marked Packets

A miniport driver that supports 802.1Q must insert 802.1Q information into a packet that the driver transmits over the network if and only if either of the following conditions is true:

Before inserting 802.1Q information into a packet, the miniport driver retrieves per-packet VLAN information by calling the NDIS_PER_PACKET_INFO_FROM_PACKET macro with the second parameter set to Ieee8021Q.

The following sample code shows how a miniport driver:

NDIS_PACKET_8021Q_INFODDK_NDIS_PACKET_8021Q_INFO_NR VlanPriInfo;
UINT32 UserPriority;
UINT32 VlanID;
VlanPriInfo.Value = 
      NDIS_PER_PACKET_INFO_FROM_PACKET(pPacketDesc, Ieee8021QInfo);
UserPriority = VlanPriInfo.TagHeader.UserPriority;
VlanID = VlanPriInfo.TagHeader.VlanId;
‹ ›

To generate the components of the packet's tag header, a miniport driver:

  1. Sets the tag header's CFI bit to zero.
  2. Proceeds as indicated in the following table, based on the following values:
Configured VLAN ID for the NIC Priority or VLAN ID in the Packet's OOB Data VLAN ID in the Packet's Tag Header Miniport Driver Action
Zero Priority and VLAN ID are zero. Any value or not present Send the packet with no changes.
Zero Priority or VLAN ID is nonzero. Not present Insert tag header into packet.

Set VLAN ID in tag header to the value of VLAN ID in OOB data.

Send packet.

Nonzero VLAN ID is zero or matches the configured VLAN ID for the NIC. Not present Insert tag header into packet.

Set VLAN ID in tag header to the value of configured VLAN ID for the NIC.

Send packet.

Nonzero VLAN ID matches the configured VLAN ID for the NIC. Zero Set VLAN ID in tag header to the value of configured VLAN ID for the NIC.

Send packet.

Nonzero Not present. Matches the configured VLAN ID for the NIC. Send the packet with no changes.

If the priority value that the miniport driver retrieves from the packet is zero, the miniport driver should not mark the packet with a priority value before transmitting the packet over the network. On Ethernet (802.3) networks, an unmarked packet is the same as a packet that is marked with the "best effort" priority value appended to it. Not marking packets ensures backward compatibility with devices on the network that do not support the tag header.

Note  If a send packet's Ethernet header specifies a protocol type (EtherType) of 802.3ad or GARP VLAN Registration Protocol (GVRP), the miniport driver should transmit the packet without modifying it.

The following table indicates the circumstances under which a miniport driver should not send an 802.1Q-marked packet.

Configured VLAN ID for the NIC Priority or VLAN ID in Packet's OOB Data VLAN ID in the Packet's Tag Header Miniport Driver Action
Nonzero VLAN ID does not match configured VLAN ID for NIC. Any value or not present Fail the send.
Nonzero Not present Does not match the configured VLAN ID for the NIC. Fail the send.
Any value Nonzero Nonzero Fail the send because VLAN ID should not be set in both OOB data and tag header.